<template>
  <div id="detailed">
    <c-title :hide="false" :text="integral ? integral + '列表' : '积分' + '明细'"></c-title>
    <diyBackGround></diyBackGround>
    <div class="statusBox">
      <div class="statusBox_left">
        <div class="txt" :class="statusValue == 0 ? 'showtxt' : ''" @click="selectStatus(0)">全部</div>
        <div class="txt" :class="statusValue == 1 ? 'showtxt' : ''" @click="selectStatus(1)">收入</div>
        <div class="txt" :class="statusValue == 2 ? 'showtxt' : ''" @click="selectStatus(2)">支出</div>
      </div>
      <div class="statusBox_right" @click.stop="selectShow = !selectShow" >
        <div class="txt">{{ source_comment[selectTapInd] }}</div>
      </div>
    </div>
    <template v-if="!noneShow">
      <template v-for="(item, index) in record_list.data">
        <div class="timeSelect" :key="index">
          <div class="timeBox" @click="show = true">
            <div class="time">{{ index }}</div>
            <van-icon name="arrow-down" size="12px" />
          </div>
          <div class="totalNum">支出：{{ money_arr[index] ? Number(money_arr[index].expand).toFixed(2) : "0.00" }} 收入：{{ money_arr[index] ? Number(money_arr[index].income).toFixed(2) : "" }}</div>
        </div>
        <div class="list" :key="index">
          <div class="lis" v-for="(info, index) in item" :key="index" @click="expand(info)">
            <div class="lisTop">
              <div class="txtName">{{ info.source_name }}</div>
              <div class="price">{{ info.point_income_type == 1 ? "+" : "" }}{{ info.point }}</div>
            </div>
            <div class="lisTop dob">
              <div class="time">{{ info.created_at }}</div>
              <div class="balance">{{integral?integral:'积分'}}：{{ info.after_point }}</div>
            </div>
          </div>
        </div>
      </template>
    </template>
    <template v-else>
      <div class="timeSelect" :key="index">
        <div class="timeBox" @click="show = true">
          <div class="time">{{ postDate }}</div>
          <van-icon name="arrow-down" size="12px" />
        </div>
        <div class="totalNum">支出：￥0.00 收入：￥0.00</div>
      </div>
      <div class="list">
        <div class="listTxt">暂无记录</div>
      </div>
    </template>

    <van-popup v-model="show" position="bottom" :style="{ height: '40%' }">
      <van-datetime-picker @confirm="pickConfirm" v-model="currentDate" type="year-month" title="选择年月" :max-date="maxDate" :formatter="formatter" />
    </van-popup>

    <van-popup v-model="selectShow" position="bottom" :style="{ height: '40%' }">
      <div class="typeBox">
        <div class="lis" :class="index == selectType ? 'lisBg' : ''" v-for="(item, index) in source_comment" :key="index" @click="selectTap(index)">
          <div class="txt">{{ item }}</div>
        </div>
      </div>
    </van-popup>
  </div>
</template>
<script>
import member_integraldetailcontroller from "./member_integrallistcontroller";
export default member_integraldetailcontroller;
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
.typeBox {
  overflow-y: scroll;
  height: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  padding: 0.625rem;
  padding-top: 1rem;

  .lis {
    width: 30%;
    padding: 0.6rem 0.625rem;
    border-radius: 0.1563rem;
    background: #9999;
    margin-right: 1rem;
    margin-bottom: 0.625rem;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;

    .txt {
      font-size: 12px;
    }
  }

  .lis:nth-child(3n) {
    margin-right: 0;
  }

  .lisBg {
    background: var(--themeBaseColor) !important;
  }
}

#detailed {
  .listTxt {
    padding: 2rem 0;
  }

  @keyframes ident {
    0% {
      opacity: 0;
    }

    50% {
      opacity: 0.75;
    }

    100% {
      opacity: 1;
    }
  }

  .showPosBox {
    animation: ident 0.5s;
  }

  .background_box {
    color: #382c0a;
    background-color: #fff;
    background-image: -webkit-gradient(linear, left top, left bottom, from(var(--themeBaseColor)), to(#f5f5f5));
    background-image: -webkit-linear-gradient(var(--themeBaseColor), #f5f5f5);
    background-image: linear-gradient(var(--themeBaseColor), #f5f5f5);
    min-height: 9.25rem;
    padding: 1.5938rem 1.0938rem 0 1.0938rem;
  }

  .statusBox {
    margin: 0 0.625rem;
    margin-top: -7rem;
    margin-bottom: 0.625rem;
    display: flex;
    justify-content: space-between;
    z-index: 1;
    position: relative;

    .statusBox_left {
      display: flex;
      font-size: 0.75rem;
      color: #262626;

      .txt {
        line-height: 1.875rem;
        width: 3.75rem;
      }

      .showtxt {
        width: 3.75rem;
        height: 1.875rem;
        background: #fff;
        border-radius: 0.9375rem;
      }
    }

    .statusBox_right {
      min-width: 5.3125rem;
      height: 1.875rem;
      background: #fdefbd;
      border-radius: 0.3125rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 0.4688rem;
      position: relative;

      .txt {
        flex: 1;
        text-align: center;
      }

      .statusBox_right_pos {
        background: #fdefbd;
        position: absolute;
        bottom: -4.3rem;
        left: 0;
        width: 100%;
        z-index: 22222222;
        border-radius: 0 0 0.3125rem 0.3125rem;

        .postxt {
          height: 1.5rem;
          line-height: 1.5rem;
        }
      }
    }
  }

  .list {
    margin: 0 0.625rem;
    padding: 0 0.875rem;
    margin-top: 0.9375rem;
    background: #fff;
    border-radius: 0.625rem;
    margin-bottom: 0.625rem;

    .lis:first-child {
      border: none;
    }

    .lis {
      display: flex;
      flex-direction: column;
      padding: 0.9375rem 0;
      border-bottom: 1px solid #f6f6f6;

      .dob {
        margin-top: 0.4688rem;
      }

      .lisTop {
        display: flex;
        justify-content: space-between;
        align-items: center;

        .txtName {
          font-size: 0.8125rem;
        }

        .price {
          font-size: 0.8125rem;
          font-weight: 500;
          color: #f20606;
        }

        .time {
          font-size: 0.6875rem;
          color: #999;
        }

        .balance {
          font-size: 0.6875rem;
          font-weight: 400;
          color: #666;
        }
      }
    }
  }

  .timeSelect {
    margin-top: -5rem;
  }

  .timeSelect {
    height: 2.5rem;
    background: #fff;
    border-radius: 0.625rem;
    margin: 0 0.625rem;
    display: flex;
    padding: 0 0.9063rem;
    align-items: center;
    position: sticky;
    top: 40px;

    .timeBox {
      flex-shrink: 0;
      display: flex;
      align-items: center;

      .time {
        margin-right: 0.5rem;
        font-size: 0.8125rem;
      }
    }

    .totalNum {
      flex: 1;
      text-align: right;
      font-size: 0.625rem;
      color: #333;
    }
  }
}
// #detailed {
//   a {
//     color: #000;
//   }

//   .mint-navbar {
//     margin-bottom: 0.125rem;
//   }

//   .mint-navbar .mint-tab-item {
//     padding: 0.875rem 0;
//   }

//   .times {
//     text-align: left;
//     text-indent: 0.625rem;
//     line-height: 2rem;
//     background: #ddd;
//   }

//   .tbs {
//     background: #fff;
//     overflow: hidden;
//     font-size: 14px;

//     .wrap {
//       padding: 0.625rem 0.875rem;
//       border-bottom: 1px solid #ebebeb;
//     }

//     .wrap::after {
//       clear: both;
//       display: block;
//       content: '';
//     }

//     .hide-item {
//       padding: 0.625rem 0.875rem;
//       border-bottom: 1px solid #ebebeb;
//       text-align: left;
//     }

//     .item1 {
//       color: #8c8c8c;
//       font-size: 12px;
//     }

//     .item2 {
//       float: left;
//       width: 70%;
//       text-align: left;

//       li {
//         line-height: 1.5rem;
//       }
//     }

//     .item3 {
//       font-size: 18px;
//       float: left;
//       width: 30%;
//       text-align: right;

//       .add {
//         color: #259b24;
//       }

//       .reduce {
//         color: #f15353;
//       }
//     }
//   }
// }
</style>